﻿var SelectData = function (e) {
    //debugger
    $.ajax({
        type: "GET",
        url: "/Extend/AjaxData/DataAction.aspx",
        data: { entity: "right", action: "roleposts", posts: $("#posts").attr("SValue"), roleid: getPar1("roleid") },
        async: false,
        success: function (data) {
            //debugger
            if (data == "1") {
                alert("设置成功");
                RefreshData();
                return;
            }
            alert("出现问题:" + data)
        },
        error: function (e) {
            debugger
            alert(e);
            return;
        }
    }
  );

}

var fnCustomDelete = function () {
    
    const_EditEntity = "SysPostRole";
    if (typeof (EditEntity) != "undefined") {
        const_EditEntity = EditEntity;
    }
    {
        var list = this.mDataTable.getRecordSet()._records;
        var elist = [];
        dl = [];
        for (var i = 0; i < list.length; i++) {
            //this.getRecordSet()._records[0]._oData["BarItem"]
            if (list[i]._oData["iSun_Selected"] == true) {
                elist.push(list[i]._oData["ID"]);
                dl.push(list[i]._sId); //获取行ID；
            }
        }
        if (elist.length == 0) {
            var recordID = myDataTable.getSelectedRows()[0];
            record = myDataTable.getRecord(recordID);
            if (editpageFlag == 0) {
                SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID);
            } else {
                SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&table=" + const_EditEntity + "&id=" + record.getData(const_entityID);
            }
        }
        else {
            if (editpageFlag == 0) {
                SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&entity=" + const_EditEntity + "&json=" + elist.join(",");
            }
            else {
                SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&table=" + const_EditEntity + "&json=" + elist.join(",");
            }
        }
        YAHOO.example.container.dialog3.show();
        //DeleteData("AjaxData/DataSave.aspx?r=" + Math.random()+"&action=delete&entity="+const_EditEntity+"&id="+record.getData(const_entityID),LoadData);           
    }
}